package com.kkang.betmachine.ryc;

import com.kkang.betmachine.config.MatheType;
import com.kkang.betmachine.entity.ZuQiuMatche;
import org.springframework.util.StringUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @author yongk_liu
 **/
public class ZuQiuRycMatcheUtil extends RycMatcheUitl {

    @Override
    public List pullMatches(MatheType matheType) {
        List matches = ZuQiuRycNetUti.pullMatch(matheType);
        return parserMatcheList(matheType, matches);
    }

    private List parserMatcheList(MatheType matheType, List rycMatches) {
        if (rycMatches == null)
            return null;
        System.out.println("开始转换为Matche类型集合");
        List<ZuQiuMatche> matches = new ArrayList<>();
        for (int i = 0; i < rycMatches.size(); i++) {
            ZuQiuRycMatche o = (ZuQiuRycMatche) rycMatches.get(i);
            ZuQiuMatche matche = new ZuQiuMatche();
            matche.setTeamId(o.getDay() + "|" + o.getWeek() + "|" + o.getTeamId());
            matche.setUnsport(StringUtils.isEmpty(o.getUnsupport()) ? "" : (o.getUnsupport().contains("_" + matheType.getJingcaiType()) ? o.getUnsupport() : ""));
            matche.setJ00001(new String[]{o.getV0(), o.getV1(), o.getV3()});
            //TODO:足球的完成
        }
        return matches;
    }
}
